﻿using System;
using System.Reflection;
using System.Deployment.Application;
using DevExpress.XtraEditors;
using JobShop.Properties;

namespace JobShop
{
    public partial class frmMain : XtraForm
    {
        private frmProcess m_ProcessForm;

        public frmMain()
        {
            InitializeComponent();
            InitializeData();
        }
        //------------------------------------------------------------------------------

        private void InitializeData()
        {
            Icon = Resources.ApplicationIcon;
            lblVersion.Caption = String.Format("Version v{0}", VesionString());
            m_ProcessForm = null;
        }
        //------------------------------------------------------------------------------

        private String VesionString()
        {
            Version version = null;
            try
            {
                version = ApplicationDeployment.CurrentDeployment.CurrentVersion;
            }
            catch (Exception)
            {
                version = Assembly.GetEntryAssembly().GetName().Version;
            }
            return String.Format("{0}.{1}.{2}", version.Major, version.Minor, version.Revision);
        }
        //------------------------------------------------------------------------------

        private void niInput_LinkPressed(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            if (m_ProcessForm == null || m_ProcessForm.IsDisposed)
                m_ProcessForm = new frmProcess();
            m_ProcessForm.Show();
        }
        //------------------------------------------------------------------------------

    }
    //------------------------------------------------------------------------------

}
//------------------------------------------------------------------------------